<?php

class sekolahTable extends Doctrine_Table
{
    public function getUserSekolah($id_sekolah) {
        $q = $this->createQuery('s')
                ->leftJoin('s.setKota k')
                ->leftJoin('s.setPropinsi p')
                ->where('s.id = ?', $id_sekolah);

        if($q->count() > 0) {
            return $q->fetchOne();
        }
        return null;
    }

    public function getSekolahList() {
        $q = $this->createQuery('s');

        $query = $q->execute();

        $result = array();
        foreach($query as $q) {
            $result[$q->getId()] = $q->getNamaSekolah();
        }

        return $result;
    }
}